1 /*
2 Copyright (c)
2014 Andrew Jones, Dario Seyb
3  Based
on 'Spriter2Unity' python code by Malhavok
4
5 Permission
is hereby granted, free of charge, to any person obtaining a copy
6 of
this software and associated documentation files (the "Software"), to deal
7 in
the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software
is
10 furnished to
do so, subject to the following conditions:
11
12 The above copyright notice and
this permission notice shall be included in
13 all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED
"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 THE SOFTWARE.
22 */

23 using
System;
24 using
UnityEngine;
25 using
System.Collections.Generic;
26 using
System.Linq;
27 using
System.Text;
28 using
System.Xml;
29
30 namespace
Assets.ThirdParty.Spriter2Unity.Editor.Spriter
31 {
32     
public class ObjectType
33     {
34         
public string Name { get; private set; }
35
36         
public static readonly ObjectType INVALID = new ObjectType("INVALID");
37         
public static readonly ObjectType Point = new ObjectType("Point");
38         
public static readonly ObjectType Box = new ObjectType("Box");
39         
public static readonly ObjectType Sprite = new ObjectType("Sprite");
40         
public static readonly ObjectType Sound = new ObjectType("Sound");
41         
public static readonly ObjectType Entity = new ObjectType("Entity");
42         
public static readonly ObjectType Variable = new ObjectType("Variable");
43
44         
private ObjectType(string name)
45         {
46             Name = name;
47         }
48         
public static ObjectType Parse(XmlElement element)
49         {
50             ObjectType
value;
51             
string objectType = element.GetString("object_type", "sprite");
52             
switch (objectType)
53             {
54                 
case "point":
55                     
value = ObjectType.Point;
56                     
break;
57                 
case "box":
58                     
value = ObjectType.Box;
59                     
break;
60                 
case "sprite":
61                     
value = ObjectType.Sprite;
62                     
break;
63                 
case "sound":
64                     
value = ObjectType.Sound;
65                     
break;
66                 
case "entity":
67                     
value = ObjectType.Entity;
68                     
break;
69                 
case "variable":
70                     
value = ObjectType.Variable;
71                     
break;
72                 
default:
73                     
value = ObjectType.INVALID;
74                     
break;
75             }
76
77             
return value;
78         }
79     }
80 }



Trò chơi đua xe động vật trong UNITY Engine 114.681 lượt xem

Gõ tìm kiếm nhanh...